package com.lening.community.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lening.community.dto.HouseDto;
import com.lening.community.pojo.Building;
import com.lening.community.pojo.House;
import com.lening.community.vo.BuildingVo;
import com.lening.community.vo.HouseVo;
import com.lening.community.vo.TableVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @ToDo:
 * @Author：潘万法
 * @date: 2024/6/3 16:55
 */
public interface HouseMapper extends BaseMapper<House> {
    Page<House> page(HouseDto houseDto);

    /**
     * 三级联动，获取楼宇hid,获取单元写房屋
     * @param HouseHid
     * @return
     */
    List<House> getUnit(Long HouseHid);

    /**
     * 导入
     * @return
     */
    @Select("select * from house")
    List<House> find();
    @Insert("INSERT into house(hid,unit_id,room_number,pulic_area,build_area,use_area,type_id,house_statu_id,house_toward," +
            "store_room_num,car_num,shi,ting,wei,delete_id,yid,remarks) VALUES(#{hid},#{unitId},#{roomNumber},#{pulicArea},#{buildArea},#{useArea},#{typeId},#{houseStatuId},#{houseToward}," +
            "#{storeRoomNum},#{carNum},#{shi},#{ting},#{wei},#{deleteId},#{yid},#{remarks})")
    int insert(House house);


    List<TableVo> getAllHouse();


    /**
     * 详情
     * @param hid
     * @return
     */
    HouseVo getById(Long hid);

    /**
     * 查询房屋数量
     * @return
     */
    int getCount();
}
